import java.util.HashSet;
import java.util.Set;

public class Test {
    class Solution {
        public int lastStoneWeight(int[] stones) {
            PriorityQueue<Integer> queue = new PriorityQueue<>((o1,o2)->o2-o1);
            for(int i=0; i<stones.length; i++){
                queue.offer(stones[i]);
            }
            while(queue.size()>1){
                int a = queue.poll();
                int b = queue.poll();
                int c = Math.abs(a-b);
                queue.offer(c);
            }
            return queue.poll();
        }
    }
    class Solution {
        public int countCharacters(String[] words, String chars) {
            int[] ch = new int[26];
            for(int i=0; i<chars.length(); i++){
                ch[chars.charAt(i)-'a']++;
            }
            int ans = 0;
            for(String s:words){
                int len = s.length();
                int[] tmp = new int[26];
                boolean flg = true;
                for(int i=0; i<len; i++){
                    int num = ++tmp[s.charAt(i)-'a'];
                    if(num > ch[s.charAt(i)-'a']){
                        flg = false;
                        break;
                    }
                }
                if(flg){
                    ans += len;
                }
            }
            return ans;
        }
    }
    public static int dayOfYear(String date) {
        String[] tmp = date.split("-");
        int[] ret = new int[3];
        for(int i=0; i<3; i++){
            ret[i] = Integer.parseInt(tmp[i]);
        }
        boolean flg= false;
        if((ret[0]%4==0 && ret[0]%100!=0) || ret[0]%400 == 0){
            flg = true;
        }
        int ans = 0;
        int[] nums = {31,28,31,30,31,30,31,31,30,31,30,31};
        for(int i=0; i<ret[1]-1; i++){
            if(flg && i==1) ans += 1;
            ans += nums[i];
        }
        return ans + ret[2];
    }

    public static void main(String[] args) {
        System.out.println(dayOfYear("2004-03-01"));
    }
}
